package com.RKB.dao;

import com.RKB.pojo.AnswerResult;
import com.RKB.pojo.AnswerResult_Composition;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface AnswerResultDao {

    @Update("update user_analysis set ${errorType}=#{score} where uid=#{uid} ")
    public void updataErrorTypeScore(String errorType,Integer score,String uid);

    @Update("update user_analysis set ${errorType_num}=#{num} where uid=#{uid} ")
    public void updataErrorNum(String errorType_num,Integer num,String uid);

    @Select("select ${errorType} from user_analysis where uid=#{uid}")
    public Integer findErrorTypeScore(String errorType,String uid);

    @Select("select ${ErrorNum} from user_analysis where uid=#{uid}")
    public Integer findErrorNum(String ErrorNum,String uid);

    @Select("select * from user_analysis where uid=#{uid}")
    public AnswerResult findOne(String uid);

    @Insert("insert into user_analysis(cid,uid) values(null,#{uid});")
    public void initializationUserAnalysis(String uid);
    @Select("select ${ErrorNum} from user_analysis_composition where uid=#{uid}")
    public Integer findErrorNum_Composition(String ErrorNum,String uid);

    @Update("update user_analysis_composition set ${errorType_num}=#{num} where uid=#{uid} ")
    public void updataErrorNum_Composition(String errorType_num,Integer num,String uid);

    @Select("select * from user_analysis_composition where uid=#{uid}")
    public AnswerResult_Composition findOne_Composition(String uid);
}
